/* 
 * Copyright [2018] [Alex/libo(liboware@gmail.com)]
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyt.tomcat.config;

import com.hyts.guava.String.Strings;
import lombok.*;

/** 
 * @author LiBo/Alex
 * @see   
 * @since TODO引入特定改变发布版本
 * @version V1.0 
 * Tomcat配置服务操作配置信息-操作配置服务
 * 默认读取classpath:下面的tomcat.properties
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class TomcatProperties {
    
    /**
     * webapp目录路径 默认为src\main\webapp
     */
    @Setter
    @Getter
    private String webappDirPath;
    
    /**
     * tomcat的目录路径 默认当前启动路径-basedir包下面
     */
    @Setter
    @Getter
    private String tomcatBasePath;
    
    /**
     * 启动服务端口
     */
    @Setter
    private String port;
    
    /**
     * contextpath请求上下文path
     */
    @Setter
    private String contextPath;
    
    /**
     * 主机地址名称-默认为localhost
     */
    @Setter
    private String host;
    
    /**
     * 字段部署-autoDeploy-默认为true
     */
    @Setter
    private String autoDeploy;


    public String getPort() {
        return Strings.compareEmptyAndSet(port,GlobalConfiguration.DEFAULT_PORT.toString());
    }

    public String getContextPath() {
        return Strings.compareEmptyAndSet(contextPath,GlobalConfiguration.DEFAULT_CONTEXT_PATH.toString());
    }

    public String getHost() {
        return Strings.compareEmptyAndSet(host,GlobalConfiguration.DEFAULT_HOST.toString());
    }

    public String getAutoDeploy() {
        return Strings.compareEmptyAndSet(autoDeploy,"true");
    }
}
